<?
    // specify shortcuts to the images

    class ThemeManager {   
        static function GetActiveTheme() {
            $theme = SettingManager::GetSetting("Active Theme");
            return $theme;
        }
        static function GetAvailableThemes() {
            $files = scandir("themes");
            $ret = array();
            foreach ($files as $file)
                if ($file[0] != '.') $ret[] = $file;
            return $ret;
        }
        static function GetStylesheet($css) {
            return "themes/" . self::GetActiveTheme() . "/css/$css";
        }
        static function GetStylesheets() {
            $base = "themes/" . self::GetActiveTheme() . "/css";
            $files = scandir($base);
            $return = array();
            foreach ($files as $key => $file) {
                if ($file[0] == '.' || is_dir("$base/$file")) continue; // filter out directories and recursive loops
                else if (!preg_match("/\.css$/",$file)) continue;       // filter out stuff that's not a stylesheet
                else 
                    $return[] = "$base/$file";
            }
            return $return;
        }
        static function GetImage($image) {
            $image = strtolower($image);
            $imagepath = "themes/" . self::GetActiveTheme() . "/img/$image" . (!preg_match("/\.\w+$/",$image) ? ".png" : "");
            return $imagepath;
        }
    }
?>